IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cms_sp_UserGroupAdd]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[cms_sp_UserGroupAdd]
GO
create procedure [dbo].[cms_sp_UserGroupAdd]
@Id int = null output,
@SiteId int = null,
@SiteGroupId int = null,
@GroupName nvarchar(250),
@IsEnabled bit,
@IsSystem bit,
@CreatedBy int,
@DateCreated datetime,
@LastUpdatedBy int = null,
@DateLastUpdated datetime = null
as
if @IsSystem is null
begin
	set @IsSystem = 0
end
insert into [dbo].[UserGroups](
[SiteId],
[SiteGroupId],
[GroupName],
[IsEnabled],
[IsSystem],
[CreatedBy],
[DateCreated]
)
values(
@SiteId,
@SiteGroupId,
@GroupName,
@IsEnabled,
@IsSystem,
@CreatedBy,
@DateCreated
)
set @Id = SCOPE_IDENTITY()
return @Id


GO

